﻿function PageHtml(pageindex, pageCount) {
    if (pageindex > 0 && pageCount > 0) {
        var content = "<ul>";
        if (pageindex == 1) {
            content += "<li class=\"manage_page_left\"><i class=\"icon iconfont\">&#xe601;</i></li>";
        }
        else {
            content += "<li class=\"manage_page_right\" tname=\"-1\"><i class=\"icon iconfont\">&#xe601;</i></li>";
        }
        content += "<li class=\"manage_page_center\"><span>" + pageindex + "</span> /<span> " + pageCount + "</span></li>";
        if (pageindex >= pageCount) {
            content += "<li class=\"manage_page_left\"><i class=\"icon iconfont\">&#xe600;</i></li>";
        }
        else {
            content += "<li class=\"manage_page_right\"  tname=\"1\"><i class=\"icon iconfont\">&#xe600;</i></li>";
        }

        content += "<li>";
        content += "<input id=\"txtPageNum\" type=\"text\" value='" + pageindex + "'></li>";
        content += "<li><a class=\"tiaozhuan\" href=\"javascript:void(0);\">跳转</a></li>";
        content += "</ul>";
        return content;
    }
    return "";
}

function queryString(s, key) {
    var val = null;
    var hashes = s.slice(s.indexOf('?') + 1).split('&');
    var index;
    for (var i = 0; i < hashes.length; i++) {
        index = hashes[i].indexOf("=");
        if (index > 0) {
            if (hashes[i].substring(0, index) == key) {
                val = hashes[i].substring(index + 1, hashes[i].length);
                break;
            }
        }
    }
    return val;
}

function bindMemuType(id, url, fn,weixinid) {
    $.ajax({
        url: url,
        type: "POST",
        async: true,
        data: { weixinid: weixinid },
        beforeSend: function () {
            //showLoading();
        },
        complete: function () {
            // hiddenLoading();
        },
        success: function (data) {
            if (data != null && data != "" && data != undefined) {
                var d = eval(data);
                $("#" + id).html("");
                var html = '<span>栏目：</span><select id="drpNewsType" >';
                html += ' <option value="-1">全部</option>';
                for (var i = 0; i < d.length; i++) {
                    html += ' <option value="' + d[i]["everyKey"] + '">' + d[i]["title"] + '</option>';
                }
                html += '</select>';
                $("#" + id).append(html);
                fn('1');
            }
        },
        error: function (jqXHR, textStatus, errorThrown) {
            //alert(errorThrown);
        }
    });
}

function getFormatDate(myDate, f, n) {
    var tmpstr = ""; var tmpint;
    myDate.setDate(myDate.getDate() + n);
    f = f.replace("yyyy", myDate.getFullYear());
    f = f.replace("yy", myDate.getFullYear() % 100);
    tmpint = myDate.getMonth() + 1;
    tmpstr = tmpint > 9 ? (tmpint) : ("0" + tmpint);
    f = f.replace("mi", myDate.getMinutes());
    f = f.replace("mm", tmpstr);
    f = f.replace("m", tmpint);
    tmpint = myDate.getDate();
    tmpstr = tmpint > 9 ? (tmpint) : ("0" + tmpint);
    f = f.replace("dd", tmpstr);
    f = f.replace("d", tmpint);
    f = f.replace("hh", myDate.getHours());
    f = f.replace("ss", myDate.getSeconds());
    return f;
};

function isnull(str) {
    return str == null || str == undefined || str == "null" || trim(str) == "";
}


